<template>
    <div class="container-1200">
      	<div class="index-release">
         <ul>
           <li>
              	<img src="./../../../static/img/index/cheyuanfabu.png" alt="">
              	<p>车源发布</p>
				<div class="ant-row ant-form-item wy-m-t-40">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<a-input placeholder='起始地' :value="departureCar" readOnly @click="magSvgShowMap('departureCar')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
								<a-input placeholder='目的地' :value="destinationCar" readOnly @click="magSvgShowMap('destinationCar')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
					<!-- 	<div class="ant-form-item-control">
							<span class="ant-form-item-children">
				                <nuxt-link v-if="!loggedIn" to="/login"><a-button>发布车源</a-button></nuxt-link>
				                <a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 2" :href="manageUrl+'#/business/car/publish?c='+(departureCar||'')+'&d='+(destinationCar||'')"><a-button>发布车源</a-button></a> 
				                <a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth'"><a-button>发布车源</a-button></a>
				                <a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth/personal'"><a-button>发布车源</a-button></a>
				                <a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 2" :href="manageUrl+'#/user/auth/enterprise'"><a-button>发布车源</a-button></a> 
							</span>
						</div> -->
						<div class="ant-form-item-control">
							<span class="ant-form-item-children">
				                <nuxt-link v-if="!loggedIn" to="/login"><a-button>发布车源</a-button></nuxt-link>
				                <a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 2" :href="manageUrl+'#/business/car/publish?c='+(departureCar||'')+'&d='+(destinationCar||'')"><a-button>发布车源</a-button></a> 
				                <a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 2" :href="manageUrl+'#/user/auth/enterprise'"><a-button>发布车源</a-button></a> 
				                <a v-if="loggedIn&& loggedUser.type == 1" @click="elasticShowModal(loggedUser.userId)"><a-button>发布车源</a-button></a>
				                <a v-if="loggedIn&& loggedUser.type == 3" @click="ShowModal()"><a-button>发布车源</a-button></a>
				                <!-- <a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth/personal'"><a-button>发布车源</a-button></a> -->

				              
							</span>
						</div>
					</div>
				</div>
           </li>
            <li>
              <img src="./../../../static/img/index/huoyuanfabu.png" alt="">
              <p>货源发布</p>

				<div class="ant-row ant-form-item wy-m-t-40">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<a-input placeholder='起始地' :value="departureSupply" readOnly @click="magSvgShowMap('departureSupply')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<a-input placeholder='目的地' :value="destinationSupply" readOnly @click="magSvgShowMap('destinationSupply')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<span class="ant-form-item-children">
			                  <nuxt-link v-if="!loggedIn" to="/login"><a-button>发布货源</a-button></nuxt-link>
			                  <a v-if="loggedIn && loggedUser.attestationStatus == 111 && loggedUser.type != 3" :href="manageUrl+'#/business/supply/publish?c='+(departureSupply||'')+'&d='+(destinationSupply||'')"><a-button>发布货源</a-button></a> 
			                  <a v-if="loggedIn && loggedUser.attestationStatus != 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth/personal'"><a-button>发布货源</a-button></a>
			                  <a v-if="loggedIn && loggedUser.attestationStatus != 111 && loggedUser.type == 2" :href="manageUrl+'#/user/auth/enterprise'"><a-button>发布货源</a-button></a> 
												<a v-if="loggedIn && loggedUser.type == 3" @click="ShowModal()"><a-button>发布货源</a-button></a>
							</span>
						</div>
					</div>
				</div>
           </li>
            <li>
              <img src="./../../../static/img/index/cangchufabu.png" alt="">
              <p>仓储发布</p>
				<div class="ant-row ant-form-item wy-m-t-40">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<a-input placeholder='城市' :value="departureStorage" readOnly @click="magSvgShowMap('departureStorage')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
						<div class="ant-form-item-control">
							<a-input placeholder='具体地址' :value="destinationStorage" readOnly @click="magSvgShowMapAddress('destinationStorage')" />
						</div>
					</div>
				</div>
				<div class="ant-row ant-form-item">
					<div class="ant-form-item-control-wrapper">
					<!-- 	<div class="ant-form-item-control">
							<span class="ant-form-item-children">
								<nuxt-link v-if="!loggedIn" to="/login"><a-button>发布仓储</a-button></nuxt-link>
								<a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 2" :href="manageUrl+'#/business/storage/publish?c='+(departureStorage||'')+'&d='+(destinationStorage||'')"><a-button>发布仓储</a-button></a> 
								<a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth'"><a-button>发布仓储</a-button></a>
								<a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth/personal'"><a-button>发布仓储</a-button></a>
								<a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 2" :href="manageUrl+'#/user/auth/enterprise'"><a-button>发布仓储</a-button></a> 
							</span>
						</div> -->
						<div class="ant-form-item-control">
							<span class="ant-form-item-children">
								<nuxt-link v-if="!loggedIn" to="/login"><a-button>发布仓储</a-button></nuxt-link>
								<a v-if="loggedIn&& loggedUser.attestationStatus == 111 && loggedUser.type == 2" :href="manageUrl+'#/business/storage/publish?c='+(departureStorage||'')+'&d='+(destinationStorage||'')"><a-button>发布仓储</a-button></a> 
								<a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 2" :href="manageUrl+'#/user/auth/enterprise'"><a-button>发布仓储</a-button></a> 
								<a v-if="loggedIn&&loggedUser.type == 1" @click="elasticShowModal(loggedUser.userId)"><a-button>发布仓储</a-button></a>
								<a v-if="loggedIn&& loggedUser.type == 3" @click="ShowModal()"><a-button>发布仓储</a-button></a>
								<!-- <a v-if="loggedIn&& loggedUser.attestationStatus != 111 && loggedUser.type == 1" :href="manageUrl+'#/user/auth/personal'"><a-button>发布仓储</a-button></a> -->
								
							</span>
						</div>
					</div>
				</div>
           </li>
         </ul>
      	</div>
      	<!-- 提示框 -->
      	 <!-- 提示认证弹框 -->
    	<Elasticc  ref='elasticc'></Elasticc>
        <!--地图Svg显示位置-->
    	<map-svg ref="mapSvgDialog" @change="mapSvgCall" @distance="distanceCall"></map-svg>
    </div>
</template>
<script>
import { environment } from './../../../server/environment'
import Elasticc from '@/components/dialog/Elasticc'
import AuthMixin from '~/mixins/auth'
export default {
	mixins: [ AuthMixin ],
	 components: {
	    Elasticc,
	  },
    data() {

	return {
		manageUrl: environment.MANAGE_URL,
		// 起运地地址
		departureCar: '',
		destinationCar: '',
		departureSupply: '',
		destinationSupply: '',
		departureStorage: '',
		destinationStorage: '',
	}
    },
    beforeCreate() {
    },
    created() {
    	// 车源发布、货源发布、仓储发布 点击要判断登录，没有登录点击跳转到登录页面，否则判断用户是否实名认证，如果实名认证跳到对应的发布页面（涉及到跨系统调用）对应选择的出发地和到达地自动赋值到发布页面，如果没有实名认证跳转到实名认证页面（分个人/企业认证），个人用户只能发布货源；
    	// this.loggedUser.attestationStatus  109未认证 110认证中   111认证成功  112认证失败 
    	// this.loggedUser.type  1个人/2企业
    	console.log('loggedUser::',this.loggedUser)
    	console.log('loggedUser::',this.loggedIn)
    },
    watch: {},

    mounted: function() {

    },
    methods: {
		// 省市地图回调
		mapSvgCall (d) {
			if (d.name == 'destinationStorage') {
				// address   addRemark 
				this.destinationStorage = d.address;
				this.departureStorage = d.provCityArea;
			}else{
				this[d.name] = d.provCityArea;
			}
		},
		 // 弹框
		 ShowModal(id){
		   this.$warning({
		     title: '您无权限操作此功能！',
		   });
		 },
	      elasticShowModal(id){
	        this.$refs.elasticc.warning(id);
	      },
		// 起运地
		magSvgShowMap (name) {
			this.$refs.mapSvgDialog.mapSvgVisible( name,2,'','','' );
		},
		// 具体地址
		magSvgShowMapAddress (name) {
			let city = this.departureStorage&&this.departureStorage.split('-') || ['','',''];
			this.$refs.mapSvgDialog.mapSvgVisible( name,3,city[0],city[1],city[2] );
		},
		// 调用距离返回
		distanceCall (num) {
		}
    }
  }
</script>
<style lang="scss" >
.wy-m-t-40{ margin-top: 40px; }
</style>